home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Dev / Bgui / include / inline / bgui.h < prev   
Encoding:
C/C++ Source or Header  |  2000-05-09  |  11.0 KB  |  365 lines

  1. #ifndef _INLINE_BGUI_H
  2. #define _INLINE_BGUI_H
  3.  
  4. #ifndef __INLINE_STUB_H
  5. #include <inline/stubs.h>
  6. #endif
  7.  
  8. #ifndef BASE_EXT_DECL
  9. #define BASE_EXT_DECL
  10. #define BASE_EXT_DECL0 extern struct Library *BGUIBase;
  11. #endif
  12. #ifndef BASE_PAR_DECL
  13. #define BASE_PAR_DECL
  14. #define BASE_PAR_DECL0 void
  15. #endif
  16. #ifndef BASE_NAME
  17. #define BASE_NAME BGUIBase
  18. #endif
  19.  
  20. BASE_EXT_DECL0
  21.  
  22. __inline Class *
  23. BGUI_GetClassPtr(BASE_PAR_DECL ULONG num)
  24. {
  25.    BASE_EXT_DECL
  26.    register Class * res __asm("d0");
  27.    register struct Library *a6 __asm("a6") = BASE_NAME;
  28.    register ULONG d0 __asm("d0") = num;
  29.    __asm volatile ("jsr a6@(-0x1E:W)"
  30.    : "=r" (res)
  31.    : "r" (a6), "r" (d0)
  32.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  33.    return res;
  34. }
  35.  
  36. __inline Object *
  37. BGUI_NewObjectA(BASE_PAR_DECL ULONG num, struct TagItem * tags)
  38. {
  39.    BASE_EXT_DECL
  40.    register Object * res __asm("d0");
  41.    register struct Library *a6 __asm("a6") = BASE_NAME;
  42.    register ULONG d0 __asm("d0") = num;
  43.    register struct TagItem * a0 __asm("a0") = tags;
  44.    __asm volatile ("jsr a6@(-0x24:W)"
  45.    : "=r" (res)
  46.    : "r" (a6), "r" (d0), "r" (a0)
  47.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  48.    return res;
  49. }
  50.  
  51. Object * BGUI_NewObject(ULONG num, Tag tags, ...)
  52. {
  53.   return BGUI_NewObjectA(num, (struct TagItem *) &tags);
  54. }
  55.  
  56. __inline ULONG
  57. BGUI_RequestA(BASE_PAR_DECL struct Window * win, struct bguiRequest * estruct, ULONG * args)
  58. {
  59.    BASE_EXT_DECL
  60.    register ULONG res __asm("d0");
  61.    register struct Library *a6 __asm("a6") = BASE_NAME;
  62.    register struct Window * a0 __asm("a0") = win;
  63.    register struct bguiRequest * a1 __asm("a1") = estruct;
  64.    register ULONG * a2 __asm("a2") = args;
  65.    __asm volatile ("jsr a6@(-0x2A:W)"
  66.    : "=r" (res)
  67.    : "r" (a6), "r" (a0), "r" (a1), "r" (a2)
  68.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  69.    return res;
  70. }
  71.  
  72. ULONG BGUI_Request(struct Window * win, struct bguiRequest * estruct, ...)
  73. {
  74.   return BGUI_RequestA(win, estruct, (ULONG *) ((ULONG) &estruct + sizeof(struct bguiRequest *)));
  75. }
  76.  
  77. __inline BOOL
  78. BGUI_Help(BASE_PAR_DECL struct Window * win, UBYTE * name, UBYTE * node, ULONG line)
  79. {
  80.    BASE_EXT_DECL
  81.    register BOOL res __asm("d0");
  82.    register struct Library *a6 __asm("a6") = BASE_NAME;
  83.    register struct Window * a0 __asm("a0") = win;
  84.    register UBYTE * a1 __asm("a1") = name;
  85.    register UBYTE * a2 __asm("a2") = node;
  86.    register ULONG d0 __asm("d0") = line;
  87.    __asm volatile ("jsr a6@(-0x30:W)"
  88.    : "=r" (res)
  89.    : "r" (a6), "r" (a0), "r" (a1), "r" (a2), "r" (d0)
  90.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  91.    return res;
  92. }
  93.  
  94. __inline APTR
  95. BGUI_LockWindow(BASE_PAR_DECL struct Window * win)
  96. {
  97.    BASE_EXT_DECL
  98.    register APTR res __asm("d0");
  99.    register struct Library *a6 __asm("a6") = BASE_NAME;
  100.    register struct Window * a0 __asm("a0") = win;
  101.    __asm volatile ("jsr a6@(-0x36:W)"
  102.    : "=r" (res)
  103.    : "r" (a6), "r" (a0)
  104.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  105.    return res;
  106. }
  107.  
  108. __inline VOID
  109. BGUI_UnlockWindow(BASE_PAR_DECL APTR lock)
  110. {
  111.    BASE_EXT_DECL
  112.    register struct Library *a6 __asm("a6") = BASE_NAME;
  113.    register APTR a0 __asm("a0") = lock;
  114.    __asm volatile ("jsr a6@(-0x3C:W)"
  115.    : /* No Output */
  116.    : "r" (a6), "r" (a0)
  117.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  118. }
  119.  
  120. __inline ULONG
  121. BGUI_DoGadgetMethodA(BASE_PAR_DECL Object * object, struct Window * win, struct Requester * req, Msg msg)
  122. {
  123.    BASE_EXT_DECL
  124.    register ULONG res __asm("d0");
  125.    register struct Library *a6 __asm("a6") = BASE_NAME;
  126.    register Object * a0 __asm("a0") = object;
  127.    register struct Window * a1 __asm("a1") = win;
  128.    register struct Requester * a2 __asm("a2") = req;
  129.    register Msg a3 __asm("a3") = msg;
  130.    __asm volatile ("jsr a6@(-0x42:W)"
  131.    : "=r" (res)
  132.    : "r" (a6), "r" (a0), "r" (a1), "r" (a2), "r" (a3)
  133.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  134.    return res;
  135. }
  136.  
  137. ULONG BGUI_DoGadgetMethod(Object * object, struct Window * win, struct Requester * req, ULONG msg, ...)
  138. {
  139.   return BGUI_DoGadgetMethodA(object, win, req, (Msg) &msg);
  140. }
  141.  
  142. __inline struct BitMap *
  143. BGUI_AllocBitMap(BASE_PAR_DECL ULONG width, ULONG height, ULONG depth, ULONG flags, struct BitMap * friend)
  144. {
  145.    BASE_EXT_DECL
  146.    register struct BitMap * res __asm("d0");
  147.    register struct Library *a6 __asm("a6") = BASE_NAME;
  148.    register ULONG d0 __asm("d0") = width;
  149.    register ULONG d1 __asm("d1") = height;
  150.    register ULONG d2 __asm("d2") = depth;
  151.    register ULONG d3 __asm("d3") = flags;
  152.    register struct BitMap * a0 __asm("a0") = friend;
  153.    __asm volatile ("jsr a6@(-0x54:W)"
  154.    : "=r" (res)
  155.    : "r" (a6), "r" (d0), "r" (d1), "r" (d2), "r" (d3), "r" (a0)
  156.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  157.    return res;
  158. }
  159.  
  160. __inline VOID
  161. BGUI_FreeBitMap(BASE_PAR_DECL struct BitMap * bitmap)
  162. {
  163.    BASE_EXT_DECL
  164.    register struct Library *a6 __asm("a6") = BASE_NAME;
  165.    register struct BitMap * a0 __asm("a0") = bitmap;
  166.    __asm volatile ("jsr a6@(-0x5A:W)"
  167.    : /* No Output */
  168.    : "r" (a6), "r" (a0)
  169.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  170. }
  171.  
  172. __inline struct RastPort *
  173. BGUI_CreateRPortBitMap(BASE_PAR_DECL struct RastPort * rport, ULONG width, ULONG height, ULONG depth)
  174. {
  175.    BASE_EXT_DECL
  176.    register struct RastPort * res __asm("d0");
  177.    register struct Library *a6 __asm("a6") = BASE_NAME;
  178.    register struct RastPort * a0 __asm("a0") = rport;
  179.    register ULONG d0 __asm("d0") = width;
  180.    register ULONG d1 __asm("d1") = height;
  181.    register ULONG d2 __asm("d2") = depth;
  182.    __asm volatile ("jsr a6@(-0x60:W)"
  183.    : "=r" (res)
  184.    : "r" (a6), "r" (a0), "r" (d0), "r" (d1), "r" (d2)
  185.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  186.    return res;
  187. }
  188.  
  189. __inline VOID
  190. BGUI_FreeRPortBitMap(BASE_PAR_DECL struct RastPort * rport)
  191. {
  192.    BASE_EXT_DECL
  193.    register struct Library *a6 __asm("a6") = BASE_NAME;
  194.    register struct RastPort * a0 __asm("a0") = rport;
  195.    __asm volatile ("jsr a6@(-0x66:W)"
  196.    : /* No Output */
  197.    : "r" (a6), "r" (a0)
  198.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  199. }
  200.  
  201. __inline VOID
  202. BGUI_InfoTextSize(BASE_PAR_DECL struct RastPort * rp, UBYTE * text, UWORD * width, UWORD * height)
  203. {
  204.    BASE_EXT_DECL
  205.    register struct Library *a6 __asm("a6") = BASE_NAME;
  206.    register struct RastPort * a0 __asm("a0") = rp;
  207.    register UBYTE * a1 __asm("a1") = text;
  208.    register UWORD * a2 __asm("a2") = width;
  209.    register UWORD * a3 __asm("a3") = height;
  210.    __asm volatile ("jsr a6@(-0x6C:W)"
  211.    : /* No Output */
  212.    : "r" (a6), "r" (a0), "r" (a1), "r" (a2), "r" (a3)
  213.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  214. }
  215.  
  216. __inline VOID
  217. BGUI_InfoText(BASE_PAR_DECL struct RastPort * rp, UBYTE * text, struct IBox * bounds, struct DrawInfo * drawinfo)
  218. {
  219.    BASE_EXT_DECL
  220.    register struct Library *a6 __asm("a6") = BASE_NAME;
  221.    register struct RastPort * a0 __asm("a0") = rp;
  222.    register UBYTE * a1 __asm("a1") = text;
  223.    register struct IBox * a2 __asm("a2") = bounds;
  224.    register struct DrawInfo * a3 __asm("a3") = drawinfo;
  225.    __asm volatile ("jsr a6@(-0x72:W)"
  226.    : /* No Output */
  227.    : "r" (a6), "r" (a0), "r" (a1), "r" (a2), "r" (a3)
  228.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  229. }
  230.  
  231. __inline STRPTR
  232. BGUI_GetLocaleStr(BASE_PAR_DECL struct bguiLocale * bl, ULONG id)
  233. {
  234.    BASE_EXT_DECL
  235.    register STRPTR res __asm("d0");
  236.    register struct Library *a6 __asm("a6") = BASE_NAME;
  237.    register struct bguiLocale * a0 __asm("a0") = bl;
  238.    register ULONG d0 __asm("d0") = id;
  239.    __asm volatile ("jsr a6@(-0x78:W)"
  240.    : "=r" (res)
  241.    : "r" (a6), "r" (a0), "r" (d0)
  242.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  243.    return res;
  244. }
  245.  
  246. __inline STRPTR
  247. BGUI_GetCatalogStr(BASE_PAR_DECL struct bguiLocale * bl, ULONG id, STRPTR def)
  248. {
  249.    BASE_EXT_DECL
  250.    register STRPTR res __asm("d0");
  251.    register struct Library *a6 __asm("a6") = BASE_NAME;
  252.    register struct bguiLocale * a0 __asm("a0") = bl;
  253.    register ULONG d0 __asm("d0") = id;
  254.    register STRPTR a1 __asm("a1") = def;
  255.    __asm volatile ("jsr a6@(-0x7E:W)"
  256.    : "=r" (res)
  257.    : "r" (a6), "r" (a0), "r" (d0), "r" (a1)
  258.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  259.    return res;
  260. }
  261.  
  262. __inline VOID
  263. BGUI_FillRectPattern(BASE_PAR_DECL struct RastPort * rport, struct bguiPattern * bpat, LONG x1, LONG y1, LONG x2, LONG y2)
  264. {
  265.    BASE_EXT_DECL
  266.    register struct Library *a6 __asm("a6") = BASE_NAME;
  267.    register struct RastPort * a1 __asm("a1") = rport;
  268.    register struct bguiPattern * a0 __asm("a0") = bpat;
  269.    register LONG d0 __asm("d0") = x1;
  270.    register LONG d1 __asm("d1") = y1;
  271.    register LONG d2 __asm("d2") = x2;
  272.    register LONG d3 __asm("d3") = y2;
  273.    __asm volatile ("jsr a6@(-0x84:W)"
  274.    : /* No Output */
  275.    : "r" (a6), "r" (a1), "r" (a0), "r" (d0), "r" (d1), "r" (d2), "r" (d3)
  276.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  277. }
  278.  
  279. __inline VOID
  280. BGUI_PostRender(BASE_PAR_DECL Class * cl, Object * obj, struct gpRender * gpr)
  281. {
  282.    BASE_EXT_DECL
  283.    register struct Library *a6 __asm("a6") = BASE_NAME;
  284.    register Class * a0 __asm("a0") = cl;
  285.    register Object * a2 __asm("a2") = obj;
  286.    register struct gpRender * a1 __asm("a1") = gpr;
  287.    __asm volatile ("jsr a6@(-0x8A:W)"
  288.    : /* No Output */
  289.    : "r" (a6), "r" (a0), "r" (a2), "r" (a1)
  290.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  291. }
  292.  
  293. __inline Class *
  294. BGUI_MakeClassA(BASE_PAR_DECL struct TagItem * tags)
  295. {
  296.    BASE_EXT_DECL
  297.    register Class * res __asm("d0");
  298.    register struct Library *a6 __asm("a6") = BASE_NAME;
  299.    register struct TagItem * a0 __asm("a0") = tags;
  300.    __asm volatile ("jsr a6@(-0x90:W)"
  301.    : "=r" (res)
  302.    : "r" (a6), "r" (a0)
  303.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  304.    return res;
  305. }
  306.  
  307. Class * BGUI_MakeClass(ULONG tags, ...)
  308. {
  309.   return BGUI_MakeClassA((struct TagItem *) &tags);
  310. }
  311.  
  312. __inline BOOL
  313. BGUI_FreeClass(BASE_PAR_DECL Class * cl)
  314. {
  315.    BASE_EXT_DECL
  316.    register BOOL res __asm("d0");
  317.    register struct Library *a6 __asm("a6") = BASE_NAME;
  318.    register Class * a0 __asm("a0") = cl;
  319.    __asm volatile ("jsr a6@(-0x96:W)"
  320.    : "=r" (res)
  321.    : "r" (a6), "r" (a0)
  322.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  323.    return res;
  324. }
  325.  
  326. __inline ULONG
  327. BGUI_PackStructureTags(BASE_PAR_DECL APTR pack, ULONG * tab, struct TagItem * tags)
  328. {
  329.    BASE_EXT_DECL
  330.    register ULONG res __asm("d0");
  331.    register struct Library *a6 __asm("a6") = BASE_NAME;
  332.    register APTR a0 __asm("a0") = pack;
  333.    register ULONG * a1 __asm("a1") = tab;
  334.    register struct TagItem * a2 __asm("a2") = tags;
  335.    __asm volatile ("jsr a6@(-0x9C:W)"
  336.    : "=r" (res)
  337.    : "r" (a6), "r" (a0), "r" (a1), "r" (a2)
  338.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  339.    return res;
  340. }
  341.  
  342. __inline ULONG
  343. BGUI_UnpackStructureTags(BASE_PAR_DECL APTR pack, ULONG * tab, struct TagItem * tags)
  344. {
  345.    BASE_EXT_DECL
  346.    register ULONG res __asm("d0");
  347.    register struct Library *a6 __asm("a6") = BASE_NAME;
  348.    register APTR a0 __asm("a0") = pack;
  349.    register ULONG * a1 __asm("a1") = tab;
  350.    register struct TagItem * a2 __asm("a2") = tags;
  351.    __asm volatile ("jsr a6@(-0xA2:W)"
  352.    : "=r" (res)
  353.    : "r" (a6), "r" (a0), "r" (a1), "r" (a2)
  354.    : "d0", "d1", "a0", "a1", "fp0", "fp1", "cc", "memory");
  355.    return res;
  356. }
  357.  
  358. #undef BASE_EXT_DECL
  359. #undef BASE_EXT_DECL0
  360. #undef BASE_PAR_DECL
  361. #undef BASE_PAR_DECL0
  362. #undef BASE_NAME
  363.  
  364. #endif /*  _INLINE_BGUI_H  */
  365.